/********************************************
 * 功能说明: 
 * 模块名称: 
 * 系统名称: 
 * 软件版权: Frank
 * 系统版本: 1.0.0
 * 开发人员: Frank
 * 开发时间: 2019/9/23 15:58
 * 审核人员: 
 * 相关文档: 
 * 修改记录: 修改日期 修改人员 修改说明
 *********************************************/
package com.spring.arch.message.dto;

import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;

import java.io.Serializable;

/**
 * 消息发送响应
 * @author Frank
 * @version 1.0.0.1
 * @since JDK 1.8
 */
@ToString
@NoArgsConstructor
@Getter
@Setter
public class MessageSenderResponse implements Serializable {

    private static final long serialVersionUID = -4356521112770775780L;

    private boolean success;
    private String msg;
    private Object result;

    public MessageSenderResponse(boolean success) {
        this.success = success;
    }

    public MessageSenderResponse(boolean success, String msg) {
        this.success = success;
        this.msg = msg;
    }

    public MessageSenderResponse(boolean success, Object result) {
        this.success = success;
        this.result = result;
    }

    public MessageSenderResponse(boolean success, String msg, Object result) {
        this.success = success;
        this.msg = msg;
        this.result = result;
    }

    /**
     * 是否发送成功
     */
    public boolean isSuccess() {
        return success;
    }

    public void setSuccess(boolean success) {
        this.success = success;
    }

    public Object getResult() {
        return result;
    }

    public void setResult(Object result) {
        this.result = result;
    }

    public static MessageSenderResponse success() {
        return new MessageSenderResponse(true);
    }

    public static MessageSenderResponse success(Object object) {
        return new MessageSenderResponse(true, object);
    }

    public static MessageSenderResponse success(String msg, Object object) {
        return new MessageSenderResponse(true, msg, object);
    }

    public static MessageSenderResponse failure() {
        return new MessageSenderResponse(false);
    }

    public static MessageSenderResponse failure(String msg) {
        return new MessageSenderResponse(false, msg);
    }
}
